/**
 * 非空验证
 * @param str
 * @returns {boolean}
 */
window.isEmpty = str => {
  if (str === undefined) return true
  if (typeof str === 'string') return str === '' || str.trim() === ''
  if (str instanceof Array) return str.length == 0
  return str === null
}

/**
 * 克隆一个对象
 * @param obj
 * @returns {null|any}
 */
window.clone = obj => {
  if (obj === undefined || obj === null) return null
  return JSON.parse(JSON.stringify(obj))
}

